<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2010 osCommerce

  Released under the GNU General  License
 */

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

// Begin product_previous_next
include(DIR_WS_MODULES . 'products_next_previous.php');
// End product_previous_next

$product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
$product_check = tep_db_fetch_array($product_check_query);

require(DIR_WS_INCLUDES . 'template_top.php');

function show_reviews($p_id,$l_id) //------By DongHP -------------
{	
   $reviews_str = '<div class="collapse shown">';
   
   $n = 0; $ok = false;
   
   $reviews_query = tep_db_query("select r.reviews_id, r.reviews_rating, r.date_added,r.products_id,rd.reviews_text,rd.review_title from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd " ." where r.reviews_status=1 and r.products_id= ".$p_id." and
 r.reviews_id = rd.reviews_id  and rd.languages_id = " .$l_id);// . "  ORDER BY r.reviews_rating DESC ");

   $c10=0;
   	while ($r = tep_db_fetch_array($reviews_query)) 
      {    
	     $n++;
        //  echo $r['date_added']."<br>";
		         
		 $reviews ='<div class="reviewstab"><div class="star_rating" id="'.$r['reviews_rating'].'_1"></div>
          <span class="reviews">'.$r['review_title'].' &nbsp; <i>'.$r['date_added'].'</i></span><div class="comment">'.$r['reviews_text'].'</div></div>';  
		
		 if ($n<4)
		   {
			 $reviews_str.=stripslashes($reviews); 
		   }
		 else if ((int)(($n-4)/10)==$c10)		 
		   {
			  $c10++; // <div class="expand" id='seemore_1'>See more 1</div>
			  $reviews_str.='</div><div class="expand" id="seemore_'.$c10.'">'.'See more ...'.'</div><div class="collapse">';
			  $reviews_str.=stripslashes($reviews);
		   }
		 else
		     {
				$reviews_str.=stripslashes($reviews); 
			 }
	  } 
	
	 if ($n != 3)
	 $reviews_str.='</div>';
	//-------javascript ---------------------------
// $("#content").expandAll({trigger: "div.expand", ref: "div.demo", localLinks: "p.top a"});
$reviews_str.='<script type="text/javascript">
$(function() {

    $("#seemore_1").toggler();
	for (var iter = 2; iter<'.($c10+1).'; iter++){		
		var seemore =$("#seemore_"+iter);
		seemore.hide();
	}

   $("#tabs-4").expandAll({trigger: "div.expand", ref: "div.demo", localLinks: "p.top a"});

});
</script>';
 
	 return $reviews_str;
}

?>
<div class="contentText"></div><!------Added by NamHai 11/07/2012(Recieved form ajax)------->
<?php 

if ($product_check['total'] < 1) {
    ?>

    <div class="contentContainer">
        <div class="contentText">
            <?php echo TEXT_PRODUCT_NOT_FOUND; ?>
        </div>

        <div style="float: right;">
            <?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?>
        </div>
    </div>

    <?php
} else {//edit by donghp p.products_realstatus,
    $product_info_query = tep_db_query("select p.products_id,p.products_review_count,p.products_rating, p.products_charges, p.products_model,p.weight_unit,p.prime,p.products_quantity,p.products_weight, pd.products_name, pd.products_description, pd.products_specifications, pd.products_experience,pd.products_status, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);

    tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int) $languages_id . "'");

    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
        $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
    } else {
        $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
    }

    if (tep_not_null($product_info['products_model'])) {
        $products_name = $product_info['products_name'] . '<br /><span class="smallText">[' . $product_info['products_model'] . ']</span>';
    } else {
        $products_name = $product_info['products_name'];
    }
    ?>

    <?php
    if ($messageStack->size('product') > 0) {
        echo $messageStack->output('product');
    }
    //----------add by donghp----------------------
    $manu_id = $product_info['manufacturers_id'];

    $m_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = " . $manu_id);

    $manufacture = tep_db_fetch_array($m_query);

    $p_review = $product_info['products_review_count'];
    $p_rating = $product_info['products_rating'];
    $p_weight = $product_info['products_weight'];
    $p_quan =  $product_info['products_quantity'];
    $p_stock = $product_info['products_status'];//products_realstatus'];
    $charges = $product_info['products_charges'];		
    $p_model = $product_info['products_model'];
	$prime = $product_info['prime'];	   
	$weight_unit = $product_info['weight_unit'];
	
    if (empty($charges)) {
        $charges = 0;
    }
    
    $p_price2 = $currencies->display_price($product_info['products_price'] + $charges, tep_get_tax_rate($product_info['products_tax_class_id']));

    $p_charges = $currencies->display_price($charges, tep_get_tax_rate($product_info['products_tax_class_id']));
    $tip_in_stock = '';

	$in_stock = '<span class="stockRed">' . $p_stock. '</span>';
    $tip_in_stock = $p_stock;//TEXT_TIP_OUT_OF_STOCK;
	
    ?>

    <?php /*
      echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>

      <div class="producInfor">
      <h1><?php echo $products_name; ?></h1>
      <p>by <a href="#" class="manufacturer"><?php echo $manufacture['manufacturers_name'];?></a></p>
      <h1 style="float: right;"><?php echo
      $products_price; ?></h1>
      </div>
     */ ?>
    <div class="prod_detail">
        <div class="thumbsec">          
            <!--------- Begin div product image ------>   
            <?php
            if (tep_not_null($product_info['products_image'])) {
                $pi_query = tep_db_query("select image, htmlcontent, s_image, l_image from " . TABLE_PRODUCTS_IMAGES . " where products_id = '" . (int) $product_info['products_id'] . "' order by sort_order");

                if (tep_db_num_rows($pi_query) > 0) {//style="float: left;  id="gallery"
                 ?>  
                   <div style="float: left; margin-top: 2px; position: relative;">
                    <div id="piGalNew" class="svwp"> 
                           <ul id="player_images">
   <?php
                            $pi_counter = 0;
                            while ($pi = tep_db_fetch_array($pi_query)) {
                                $pi_counter++;

                                $pi_entry = '<a href="' .  $pi['l_image'] . '" title="' . $product_info['products_name'] . '" rel="lightbox"><li>' .  tep_image_slider( $pi['image'], $product_info['products_name'], '285','230');

                                $pi_entry .= '</li></a>';
								
                                echo $pi_entry;
                            }
                            ?>
                            </ul>
                        </div>
                   </div>     
                    <?php
                } else { //DIR_WS_IMAGES . DIR_WS_IMAGES . 
				 
                    ?>
                   <div style="float: left; margin-top: 2px; position: relative;">
                    <div id="piGalNew" class="svwp">
                        <ul id="player_images">
                        <?php echo '<a href="' . tep_href_link($product_info['products_image']) . '" target="_blank" rel="fancybox">' . tep_image($product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>'; ?>                        </ul>                        
                      </div>
                    </div>
                    <?php
                    //products_id
                }
            }
            ?>
            <!--------- End div gallary image ------>               
        </div>
<?php    
//$country_id_default= 43;// chile

$sources_array = array(array('id' => 1, 'text' => '1'));

for ($i=2;$i<11;$i++) 
 { $sources_array[] = array('id' => $i, 'text' => ''.$i); }
?> 
        <div class="descshort">
            <div class="title_prod"><?php echo $products_name; ?></div>                              
            <div class="row_model">
                <div class="manufac">by <a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manu_id); ?>"><?php echo $manufacture['manufacturers_name']; ?></a></div>
                <div class="right"><?php echo MODEL_NUMBER.' : '.$p_model;?></div>
            </div>
            <div class="row_model">
                 <div class="exemple">	
                    <div class="star_rating" id="<?php echo $p_rating; ?>_1"></div>
                    <span class="reviews"><?php echo '('.$p_rating . '/5)'; ?></span>	
                </div>                 
                <div class="right2"><?php echo sprintf(RATING_BASED_ON, $p_review);?></div>
             </div>
             
            <hr  noshade="noshade" size="1"/>          
            <div class="prices">
           <p><?php echo SPOT_PRICE; ?> : <span class="newprice"><?php echo $products_price; ?></span>
            <?php echo '<a href="javascript:void(0);" class="tooltip">' . tep_image(DIR_WS_IMAGES . 'layout/tip.png',SPOT_PRICE) . '<span class="classic">' . SPOT_PRICE . '</span>' . '</a>'; ?>
           </p>
                  
           <p><?php echo NORMAL_PRICE; ?> : <span class="oldprice"> <?php echo $p_price2; ?></span>
            <?php echo '<a href="javascript:void(0);" class="tooltip">' . tep_image(DIR_WS_IMAGES . 'layout/tip.png',NORMAL_PRICE) . '<span class="classic">' . NORMAL_PRICE . '</span>' . '</a>'; ?>       
           </p> 
            </div>
             <div class="payment"><span class="center_title"><?php echo DEPOSIT_TRANSFER;?></span></div>
             <div class="payment"><?php echo tep_image(DIR_WS_IMAGES . 'icon/tarjetas.jpg',DEPOSIT_TRANSFER,154,21);?>
             </div>
            <hr  noshade="noshade" size="1"/>
            <div class="instock">
                <div class="status"><?php echo $in_stock; ?></div>
                <div class="tip_stock">
                    <?php echo '<a href="javascript:void(0);" class="tooltip">' . tep_image(DIR_WS_IMAGES . 'layout/tip.png') . '<span class="classic">' . $tip_in_stock . '</span>' . '</a>'; ?>

                </div>

                <div class="addcart"><?php echo TEXT_QUANTITY; 
				 echo tep_draw_pull_down_menu('cart_quantity[]',$sources_array, 1, ''); 
				  //<input type="text" name="cart_quantity[]" id = "cart_quantity" value="0" size="4"/>
				?>                   
           <input type="hidden" name="products_id[]" value=""/>
           <input type="hidden" name="products_charges[]" id="products_charges" value="<?php echo $charges; ?>"/>
                </div>
               <div class="by_now">  
              <?php echo '<a href = "'.tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $product_info['products_id'])  . '"> '.IMAGE_BUTTON_BUY_NOW.'</a> | ';
  
  echo '<a href = "'.tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_cart&products_id=' . $product_info['products_id'])  . '"> '.IMAGE_BUTTON_IN_CART.'</a>'; ?>
  </div>
            </div> 
 			
            <hr  noshade="noshade" size="1"/>            
            <div class="row_model">
                <div class="purchaseimg">
            <?php echo tep_image(DIR_WS_IMAGES . 'icon/shipping_car.png',DEPOSIT_TRANSFER,32,32)?> </div>    
                <div class="purchase"><?php //date_default_timezone_set('UTC');				
				echo sprintf(PURCHASE_THIS_PRODUCT,tep_shipping_day(date('Y-m-d'),$prime));			
				?>
                </div>       
             </div>
           

            <hr noshade="noshade" size="1"/>
            
            
            <!-- -----------------Modify and Added by NamHai 11/07/2012------------- -->
            <script language='javascript' type='text/javascript'>
				function get_zones(){
				var country_id = $("#entry_country_id option:selected").val();
				
				//alert(country_id);

				$.post("zones_ajax.php", { country_id_post: country_id}, function(data) {

                	//alert(data);
               		$('span#zones').html(data);
            	});
			}
			</script>

            <div class="freight">
                <p><?php echo FREIGHT_INFO;?> :</p>
                <div class="line">
                    <span class="label_info">Country</span><?php echo tep_get_country_list('entry_country_id', tep_get_countries_id("Chile"), 'onchange="javascript: get_zones();"'); ?>   
                </div>
                <div class="line">
                    <span class="label_info">Zone</span><span id="zones"><?php echo tep_draw_pull_down_menu('zone_id',tep_get_country_zones(tep_get_countries_id("Chile")), 1, ''); ?> </span>
                </div> 
           <!-- ------------------------End by NamHai 11/07/2012------------------- -->   
                <?php
                $currencies_array = $currencies->currencies;
                $cCurrentcy = $currencies_array[$currency];
                ?>
                <div class="line">
                    <span class="label_info">Freight</span><select style="width:160px; vertical-align:top" name="cboFreight" id="cboFreight"><option value="3" selected="">Fedex Courier Service</option><option value="8">DHL Courier Service</option><option value="19">Local Pickup</option></select>                        
	<?php //echo tep_draw_button(IMAGE_BUTTON_OK, '', 'calculator_charges(' . $cCurrentcy['decimal_places'] . ',\'' . TEXT_ERROR_INPUT_NUMBERIC . '\');','','',TRUE); 
	echo '<a href="javascript:void(0);" onclick="calculator_charges(' . $cCurrentcy['decimal_places'] . ',\'' . TEXT_ERROR_INPUT_NUMBERIC . '\');"><font color="#0033FF">Pre Caculate</font></a>';
	?>  
                </div>

				<div class="line">
                    <span class="label_info1"><?php echo TEXT_WEIGHT; ?></span><!-- ----Added by NamHai 11/07/2012----- -->
			<input type="text" name="ship_weight" id = "ship_weight" value="<?php echo $p_weight;?>" size="8"/> <?php echo $weight_unit;?>           
                                                                
					<span class="label_info3"><?php echo tep_draw_pull_down_menu('quantityPur',$sources_array, 1, ''); ?></span>	
                    <span class="label_info2">Quantity</span>
                    
                                                                     
                </div>
                
                <div class="line">
                 <span class="label_info1">Charges</span>                  
                     <span class="newprice"><?php echo $cCurrentcy['symbol_left']; ?>
                     <span id="display_changes"><?php echo number_format($charges, $cCurrentcy['decimal_places']); ?></span>
					 <?php echo $cCurrentcy['symbol_right']; ?></span>
                </div>
                 
                <hr noshade="noshade" size="1"/>
                <script type="text/javascript">var switchTo5x=false;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "a335845c-dc42-4a1b-bfce-dd3a5e31344f"}); </script>

                <div class="line">
                <?php //--------Added to modify by NamHai 11/07----------
                echo "Share: "; ?>
                 <span class='st_sharethis' ></span>
                    <span class='st_facebook' ></span>
                    <span class='st_twitter' ></span>
                    <span class='st_linkedin'></span>
                    <span class='st_email' ></span>
                 <font color="#0033ff">
	                <?php 
	                echo " |.Add to Watch list";
	                ?>
                </font>
				</div><!------- End by NamHai 11/07------->
            </div> 
            <div class="clear"></div>
        </div>
    </div>
    <?php
// Begin product_previous_next
    // if ( ($product_check['total'] > 0) && ( (PREVIOUS_NEXT_PRODUCT_LINK_NAVIGATION == 'Top') || (PREVIOUS_NEXT_PRODUCT_LINK_NAVIGATION == 'Both') ) ) {
    //   echo $prevnextProductLinkDisplay;
    // }
// End product_previous_next
    ?>

    <div class="contentContainer">
        <div class="contentText1">

            <?php //echo stripslashes($product_info['products_description']);  ?>

            <?php
            $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int) $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int) $languages_id . "'");
            $products_attributes = tep_db_fetch_array($products_attributes_query);
            if (FALSE) {/* if ($products_attributes['total'] > 0) {  disable available options based on client request */
                ?>

                <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>

                <p>
                    <?php
                    $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int) $HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int) $languages_id . "' order by popt.products_options_name");
                    while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
                        $products_options_array = array();
                        $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int) $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int) $languages_id . "'");
                        while ($products_options = tep_db_fetch_array($products_options_query)) {
                            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
                            if ($products_options['options_values_price'] != '0') {
                                $products_options_array[sizeof($products_options_array) - 1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ') ';
                            }
                        }

                        if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
                            $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
                        } else {
                            $selected_attribute = false;
                        }
                        ?>
                        <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
                        <?php
                    }
                    ?>
                </p>

                <?php
            }
            ?>

            <div style="clear: both;"></div>

            <?php
            if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
                ?>

                <p style="text-align: center;"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></p>

                <?php
            }
            ?>

        </div>

        <?php
// Begin product_previous_next
        if (($product_check['total'] > 0) && ( (PREVIOUS_NEXT_PRODUCT_LINK_NAVIGATION == 'Bottom') || (PREVIOUS_NEXT_PRODUCT_LINK_NAVIGATION == 'Both') )) {
            echo $prevnextProductLinkDisplay;
        }
// End product_previous_next
        ?>

        <?php
        $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and reviews_status = 1");
        $reviews = tep_db_fetch_array($reviews_query);
		
        ?>

        <!--div class="buttonSet">
            <?php if ($products_price > 0) { ?>
                <span class="buttonAction"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary'); ?></span>
            <?php } else { ?>
                <span class="buttonAction"><?php echo tep_draw_button(TEXT_CONTACT_US, 'cart', tep_href_link(FILENAME_CONTACT_US), 'primary'); ?></span>
            <? } ?>
            <?php echo tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] > 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params())); ?>
        </div-->

        <?php
		
	   include(DIR_WS_MODULES . FILENAME_RELATED_PRODUCTS); //-----add by donghp -----
	
        if ((USE_CACHE == 'true') && empty($SID)) {
            echo tep_cache_also_purchased(3600);
        } else {
            include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
        }
        ?>

    </div>

    </form>
<?php //-----------By DongHP--------------

$reviews_str = show_reviews((int)($product_info['products_id']),(int)$languages_id);

 $q = tep_db_query("select video from " .TABLE_PRODUCTS_VIDEOS. " where products_id = ".$product_info['products_id']);
				
 $f = tep_db_fetch_array($q);
 $video = '';
 if ($f) $video= $f['video'];  
/* 
<div id="mediaplayer">JW Player goes here</div>
	<script type="text/javascript">
		jwplayer("mediaplayer").setup({
			flashplayer: "ext/jwplayer/player.swf",
			file: "video.mp4",
			image: "preview.jpg",
			autostart: true,
            volume: 80,
            width: 600
		});
	</script>
 */    
function video_mp4($url)
{
	$id=  base_convert( md5( microtime() ), 16, 10);  
	$id = substr($id, 10, 6);
	
    return '<div id="mediaplayer'.$id.'">JW Player goes here</div>
	<script type="text/javascript">
		jwplayer("mediaplayer'.$id.'").setup({
			flashplayer: "ext/jwplayer/player.swf",
			file: "'.$url.'",
			autostart: true,
            volume: 80,
            width: 592,
			height: 333
		});
	</script>';
}

function video_amazon($url)
{
	$id=  base_convert( md5( microtime() ), 16, 10);  
	$id = substr($id, 10, 6);
	
	$st='<div id="'.$id.'" style="overflow-x: hidden; overflow-y: hidden; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(0, 0, 0); width: 600px; height: 400px; background-position: initial initial; background-repeat: initial initial; ">
   <object type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" quality="high" data="http://g-ecx.images-amazon.com/images/G/01/am3/20120510035744301/AMPlayer._V148501545_.swf" 
   width="100%" height="100%" id="img" style="visibility: visible; ">
   <param name="FlashVars" value="playerMode=embedded" />
   <param name="allowscriptaccess" value="always">
   <param name="allowfullscreen" value="true">
   <param name="wmode" value="transparent">
  <param name="quality" value="high">
  <param name="flashvars" value="xmlUrl='.$url.'">
  </object></div>';
  
  return $st;
}
?>
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1"><?php echo TEXT_SPECIFICATIONS; ?></a></li>
            <li><a href="#tabs-2"><?php echo TEXT_DESCRIPTION; ?></a></li>
            <li><a href="#tabs-3"><?php echo TEXT_VIDEO; ?></a></li>
            <li><a href="#tabs-4"><?php echo TEXT_EXPERIENCES; ?>(<?php echo $reviews['count'];?>)</a></li>
            <li><a href="#tabs-5"><?php echo TEXT_QUESTIONS; ?></a></li>
        </ul>
        <div id="tabs-1">
            <?php echo stripslashes($product_info['products_specifications']); ?>
        </div>
        <div id="tabs-2">
            <?php echo stripslashes($product_info['products_description']); ?>
        </div>
        <div id="tabs-3">
         <?php if (!empty($video)) { echo video_mp4($video); }
		      else { echo NO_VIDEOS;   }
		?>
        </div>
        <div id="tabs-4">
             <div class="demo">
                        <?php echo stripslashes($reviews_str); ?>
              </div>
        </div>
        <div id="tabs-5">
            <!--start Product Questions--> 
            <?php
            $qtns_qry = tep_db_query("select * from  " . TABLE_PRODUCT_QUESTIONS . " where product_id='" . $HTTP_GET_VARS['products_id'] . "' and status='1' order by date_added limit " . MAX_DISPLAY_PRODUCT_QUESTIONS);

            $tab2content = '';
            if (tep_db_num_rows($qtns_qry) == 0) {
                $tab2content .= '<p>' . NO_PRODUCT_QUESTIONS . '</p>';
            } else {
                $i = 0;
                $tab2content .= '<ol>';
                while ($qtnslist = tep_db_fetch_array($qtns_qry)) {
                    $tab2content .= '<li><strong>' . $qtnslist['question'] . '</strong> By ' . $qtnslist['customer_name'] . ' <br> &nbsp;';
                    $tab2content .= '<em>' . $qtnslist['answer'] . '</em></li>';
                    $i++;
                }
                $tab2content .= '</ol>';

                if ($i >= MAX_DISPLAY_PRODUCT_QUESTIONS) {
                    $tab2content .= tep_draw_button(TEXT_VIEW_ALL, 'triangle-1-e', tep_href_link(FILENAME_PRODUCT_QUESTIONS, 'products_id=' . $HTTP_GET_VARS['products_id']));
                }
            }
            $tab2content .= tep_draw_button(TEXT_ASK_QUESTION, 'comment', tep_href_link(FILENAME_ASK_QUESTION, 'products_id=' . $HTTP_GET_VARS['products_id']));

            //echo $tab2content;
            ?>
            <!--end Product Questions-->
        </div>
    </div>

    <script>
        $(function() {
            $( "#tabs" ).tabs();
        });
    </script>

    <?php
}

require(DIR_WS_INCLUDES . 'template_bottom.php');
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>